var n = require("../../api/utils/logUtil.js"),
  o = [1, 2];
module.exports = {
  SENSORS: o,
  start: function (o) {
    var e =
      arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null;
    n.d("sensor start : ", "------" + o + "-----"),
      1 == o
        ? (wx.startAccelerometer({
            complete: function (n) {
              null != e && e.onComplete(o, n);
            },
            success: function (n) {
              null != e && e.onSuccess(o, n);
            },
            fail: function (n) {
              null != e && e.onFail(o, n);
            },
          }),
          wx.onAccelerometerChange(function (l) {
            n.d("sensor onAccelerometerChange : ", "------" + o + "-----"),
              null != e && e.onChange(o, l);
          }))
        : 2 == o &&
          (wx.startGyroscope({
            interval: "normal",
            complete: function (n) {
              null != e && e.onComplete(o, n);
            },
            success: function (n) {
              null != e && e.onSuccess(o, n);
            },
            fail: function (n) {
              null != e && e.onFail(o, n);
            },
          }),
          wx.onGyroscopeChange(function (n) {
            null != e && e.onChange(o, n);
          }));
  },
  stop: function (o) {
    var e =
      arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null;
    n.d("sensor stop : ", "------" + o + "-----"),
      1 == o
        ? (wx.startAccelerometer({
            complete: function (n) {
              null != e && e.onComplete(o, n);
            },
            success: function (n) {
              null != e && e.onSuccess(o, n);
            },
            fail: function (n) {
              null != e && e.onFail(o, n);
            },
          }),
          wx.offAccelerometerChange(null))
        : 2 == o &&
          (wx.stopGyroscope({
            complete: function (n) {
              null != e && e.onComplete(o, n);
            },
            success: function (n) {
              null != e && e.onSuccess(o, n);
            },
            fail: function (n) {
              null != e && e.onFail(o, n);
            },
          }),
          wx.offGyroscopeChange(null));
  },
};
